<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Vixcity</title><meta name="author" content="Vixcity"><meta name="copyright" content="Vixcity"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta property="og:type" content="website">
<meta property="og:title" content="Vixcity">
<meta property="og:url" content="http://vixcity.gitee.io/my-gitee-blog/page/2/index.html">
<meta property="og:site_name" content="Vixcity">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://vixcity.gitee.io/my-gitee-blog/img/avatar.png">
<meta property="article:author" content="Vixcity">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://vixcity.gitee.io/my-gitee-blog/img/avatar.png"><link rel="shortcut icon" href="/my-gitee-blog/img/favicon.ico"><link rel="canonical" href="http://vixcity.gitee.io/my-gitee-blog/page/2/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//fonts.googleapis.com" crossorigin=""/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/my-gitee-blog/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;display=swap" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/my-gitee-blog/',
  algolia: undefined,
  localSearch: {"path":"/my-gitee-blog/search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":1,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"简"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: '/my-gitee-blog/',
      css: '/my-gitee-blog/'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Vixcity',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2022-07-15 09:29:35'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="/my-gitee-blog/css/mycss.css"><link rel="stylesheet" href="/my-gitee-blog/css/newStyle.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome-animation@1.1.1/css/font-awesome-animation.css"><link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/css/main.css"><!-- hexo injector head_end start --><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/hexo-electric-clock@1.0.6/clock.css"><link rel="stylesheet" href="https://unpkg.zhimg.com/hexo-butterfly-wowjs/lib/animate.min.css" media="print" onload="this.media='screen'"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 5.4.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/my-gitee-blog/img/avatar.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/my-gitee-blog/archives/"><div class="headline">文章</div><div class="length-num">55</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/my-gitee-blog/tags/"><div class="headline">标签</div><div class="length-num">50</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/my-gitee-blog/categories/"><div class="headline">分类</div><div class="length-num">18</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/my-gitee-blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/PicBed"><i class="fa-fw fas fa-image"></i><span> 图库</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('/my-gitee-blog/img/%E5%A4%A7%E5%9C%B0%E7%90%83%E8%83%8C%E6%99%AF.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/my-gitee-blog/">Vixcity</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/my-gitee-blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/PicBed"><i class="fa-fw fas fa-image"></i><span> 图库</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">Vixcity</h1><div id="site-subtitle"><span id="subtitle"></span></div><div id="site_social_icons"><a class="social-icon" href="https://github.com/Vixcity" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:2091283625@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="smallVerse"><i class="fa fa-heart faa-wrench animated" aria-hidden="true"></i><div class="ml20">最是人间留不住，朱颜辞镜花辞树</div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2022/01/06/%E3%80%90TypeScript%E3%80%91TS%E7%9A%84%E4%B8%80%E4%BA%9B%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E5%85%A5%E9%97%A8/" title="【TypeScript】TS的一些基础知识入门"><img class="post_bg" src="/my-gitee-blog/img/TS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【TypeScript】TS的一些基础知识入门"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2022/01/06/%E3%80%90TypeScript%E3%80%91TS%E7%9A%84%E4%B8%80%E4%BA%9B%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E5%85%A5%E9%97%A8/" title="【TypeScript】TS的一些基础知识入门">【TypeScript】TS的一些基础知识入门</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-01-05T16:00:00.000Z" title="发表于 2022-01-06 00:00:00">2022-01-06</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/TypeScript/">TypeScript</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/TypeScript/">TypeScript</a></span></div><div class="content">这是我准备打算摸鱼写的最近的ts的心得，但是奈何老板马上就让我改东西了，所以这个东西就晚上写吧
TS的一些基础知识入门什么是TypeScript我们来看一下什么是TypeScript
官网上是这么说的
123TypeScript是JavaScript类型的超集，它可以编译成纯JavaScript。TypeScript可以在任何浏览器、任何计算机和任何操作系统上运行，并且是开源的。

TypeScript为JS增加了类型系统，补齐了JS的短板
因为JS本身是没有类型系统的，这就导致了许多的错误是类型错误
TypeScript 与之 JavaScript有什么优势
类型化思维，使得开发更严谨，提前发现错误，减少改Bug时间
类型系统提高了代码的可读性，并使得维护和重构更加容易
补充了接口、枚举等开发大型应用时缺失的功能

Vue3的代码是用的TS重写的，这就声明了一个重要的信号，TS是未来的趋势
第一个TypeScript 的 HelloWord因为node是不可以直接解析TS的，所以我们需要一个npm包的支持
1npm i -g typescripts

有了这个包，就可以解析我们的Ty ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/10/25/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91validate-npm-package-name%20%E9%AA%8C%E8%AF%81%E6%98%AF%E5%90%A6%E6%98%AF%E4%B8%AA%E6%9C%89%E6%95%88%E7%9A%84%20npm%20%E5%8C%85%E5%90%8D/" title="【源码阅读】validate-npm-package-name 验证是否是个有效的 npm 包名"><img class="post_bg" src="/my-gitee-blog/img/NodeJs.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【源码阅读】validate-npm-package-name 验证是否是个有效的 npm 包名"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/25/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91validate-npm-package-name%20%E9%AA%8C%E8%AF%81%E6%98%AF%E5%90%A6%E6%98%AF%E4%B8%AA%E6%9C%89%E6%95%88%E7%9A%84%20npm%20%E5%8C%85%E5%90%8D/" title="【源码阅读】validate-npm-package-name 验证是否是个有效的 npm 包名">【源码阅读】validate-npm-package-name 验证是否是个有效的 npm 包名</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-24T16:00:00.000Z" title="发表于 2021-10-25 00:00:00">2021-10-25</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E6%BA%90%E7%A0%81/">源码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/Node/">Node</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E6%BA%90%E7%A0%81/">源码</a></span></div><div class="content">【源码阅读】validate-npm-package-name 验证是否是个有效的 npm 包名准备条件这期的源码比较简单，我们直接来看
首先上一个github地址
然后我们可以直接看他的readme文档

这一段非常简洁清晰的表明了这个包的用途
老样子，我们克隆一下，然后安装一下依赖，这里就不过多赘述
今天呢，我们就不从他的测试入手了，我们从他的example入手

我们新建一个example文件
在这个文件中输入以下js代码
12345678var validate = require(&quot;./index&quot;) validate(&quot;some-package&quot;)validate(&quot;example.com&quot;)validate(&quot;under_score&quot;)validate(&quot;123numeric&quot;)validate(&quot;@npm/thingy&quot;)validate(&quot;@jane/foo.js&quot;)

然后按照我上期的方法进行调试即可食用
开始调试我们打上对应断 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/10/23/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91update-notifier%20%E6%9B%B4%E6%96%B0%20CLI%20%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E7%9A%84%E9%80%9A%E7%9F%A5-%E8%AF%A6%E8%A7%A3/" title="【源码阅读】update-notifier 更新 CLI 应用程序的通知-详解"><img class="post_bg" src="/my-gitee-blog/img/NodeJs.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【源码阅读】update-notifier 更新 CLI 应用程序的通知-详解"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/23/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91update-notifier%20%E6%9B%B4%E6%96%B0%20CLI%20%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E7%9A%84%E9%80%9A%E7%9F%A5-%E8%AF%A6%E8%A7%A3/" title="【源码阅读】update-notifier 更新 CLI 应用程序的通知-详解">【源码阅读】update-notifier 更新 CLI 应用程序的通知-详解</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-22T16:00:00.000Z" title="发表于 2021-10-23 00:00:00">2021-10-23</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E6%BA%90%E7%A0%81/">源码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/Node/">Node</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E6%BA%90%E7%A0%81/">源码</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/CLI/">CLI</a></span></div><div class="content">前言Hello，大家好，这里是V同学
今天我们又来看源码了
今天若川大大没有写源码阅读的掘金文章
正好，可以让我们一试身手
考验一下我们之前跟随着川大的源码所锻炼的源码阅读能力
今天我们要看的是 update-notifier 的源码
老样子，在我们阅读源码之前，先分析一手，看看这个到底是干嘛用的吧
分析这个是我们本期源码阅读的代码仓库
大家可以先克隆下来，我们且慢慢分析
我们可以用5w1h分析法来试着去分析一下
5w1h那么什么是5w1h呢，简单来说就是从

原因（Why）
对象（What）
地点（Where）
时间（When）
人员（Who）
方法（How）

这六个纬度去思考
那我们就一个一个来
What首先，我们要来看看本期源码是什么
通过度娘，我们可以大致的了解到，我们本期要看的源码
似乎是一个和更新有关的工具，可以更新你的npm包和cli应用程序

我们在看一下仓库的readme

现在就非常的清晰明了了，这是一个以非入侵的方式通知你更新的这么一个工具
Why那么我们为什么要读它的源码呢
有一下几点
123451. 美化终端输出信息，描绘边框。2. 我们可以学会怎么去开启子 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/10/22/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91Vue-release%20%E5%B0%A4%E9%9B%A8%E6%BA%AA%E5%8F%91%E5%B8%83%20Vue.js%20%E7%9A%84%E6%B5%81%E7%A8%8B%E4%BB%A5%E5%8F%8A%E8%87%AA%E5%8A%A8%E5%8C%96%E5%8F%91%E5%B8%83%E5%8A%9F%E8%83%BD%E7%9A%84%E5%AE%9E%E7%8E%B0/" title="【源码阅读】Vue-release 尤雨溪发布 Vue.js 的流程以及自动化发布功能的实现"><img class="post_bg" src="/my-gitee-blog/img/vue%E7%9B%B8%E5%85%B3.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【源码阅读】Vue-release 尤雨溪发布 Vue.js 的流程以及自动化发布功能的实现"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/22/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91Vue-release%20%E5%B0%A4%E9%9B%A8%E6%BA%AA%E5%8F%91%E5%B8%83%20Vue.js%20%E7%9A%84%E6%B5%81%E7%A8%8B%E4%BB%A5%E5%8F%8A%E8%87%AA%E5%8A%A8%E5%8C%96%E5%8F%91%E5%B8%83%E5%8A%9F%E8%83%BD%E7%9A%84%E5%AE%9E%E7%8E%B0/" title="【源码阅读】Vue-release 尤雨溪发布 Vue.js 的流程以及自动化发布功能的实现">【源码阅读】Vue-release 尤雨溪发布 Vue.js 的流程以及自动化发布功能的实现</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-21T16:00:00.000Z" title="发表于 2021-10-22 00:00:00">2021-10-22</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E6%BA%90%E7%A0%81/">源码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E6%BA%90%E7%A0%81/">源码</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/Vue/">Vue</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/Vue-release/">Vue-release</a></span></div><div class="content"> 首先了解下vuejs的发布流程

环境准备你需要确保 Node.js 版本是 10+, 而且 yarn 的版本是 1.x Yarn 1.x。
如果你安装的 Node.js 版本是低于 10的话，推荐用 nvm 这个Node版本管理工具
vue-next ==&gt; package.json12345678910111213141516// vue-next/package.json&#123;    &quot;private&quot;: true,    &quot;version&quot;: &quot;3.2.4&quot;,    &quot;workspaces&quot;: [        &quot;packages/*&quot;    ],    &quot;scripts&quot;: &#123;        // --dry 参数是自己加的，如果是调试 代码也建议加        // 这句话的意思是  // 不执行测试和编译 、不执行 推送git等操作        // 也就是说空跑，只是打印        &quot;release&quot; ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/10/20/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91koa%E6%B4%8B%E8%91%B1%E6%A8%A1%E5%9E%8B%E4%B8%8Ekoa-compose/" title="【源码阅读】koa洋葱模型与koa-compose"><img class="post_bg" src="/my-gitee-blog/img/NodeJs.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【源码阅读】koa洋葱模型与koa-compose"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/20/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91koa%E6%B4%8B%E8%91%B1%E6%A8%A1%E5%9E%8B%E4%B8%8Ekoa-compose/" title="【源码阅读】koa洋葱模型与koa-compose">【源码阅读】koa洋葱模型与koa-compose</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-19T16:00:00.000Z" title="发表于 2021-10-20 00:00:00">2021-10-20</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E6%BA%90%E7%A0%81/">源码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/Node/">Node</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/Koa/">Koa</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E6%BA%90%E7%A0%81/">源码</a></span></div><div class="content">【源码阅读】koa洋葱模型与koa-compose很干的干货我们直接开始
老样子，我们先来看源码
源码123456789101112131415161718192021222324252627282930313233343536373839404142434445464748&#x27;use strict&#x27;/** * Expose compositor. */module.exports = compose/** * Compose `middleware` returning * a fully valid middleware comprised * of all those which are passed. * * @param &#123;Array&#125; middleware * @return &#123;Function&#125; * @api public */function compose (middleware) &#123;   if (!Array.isArray(middleware)) throw new TypeError(&#x2 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/10/19/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91co.js%20-%20%E8%AE%A9%E5%BC%82%E6%AD%A5%E7%9A%84%E4%BB%A3%E7%A0%81%E5%90%8C%E6%AD%A5%E5%8C%96/" title="【源码阅读】co.js - 让异步的代码同步化"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【源码阅读】co.js - 让异步的代码同步化"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/19/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91co.js%20-%20%E8%AE%A9%E5%BC%82%E6%AD%A5%E7%9A%84%E4%BB%A3%E7%A0%81%E5%90%8C%E6%AD%A5%E5%8C%96/" title="【源码阅读】co.js - 让异步的代码同步化">【源码阅读】co.js - 让异步的代码同步化</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-18T16:00:00.000Z" title="发表于 2021-10-19 00:00:00">2021-10-19</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E6%BA%90%E7%A0%81/">源码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/Koa/">Koa</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E6%BA%90%E7%A0%81/">源码</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/Co-js/">Co.js</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E5%BC%82%E6%AD%A5/">异步</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E5%90%8C%E6%AD%A5/">同步</a></span></div><div class="content">co.js - 让异步的代码同步化什么是co.js在阅读源码之前，首先我们要了解一下这个库是干啥的
通过百度，我们可以捕捉到以下这么几个关键词


promise对象
让异步的代码同步化
异步
KOA框架的核心库
ES6 Generator
同步

那么我们就可以大胆的先猜测以下几点

他是个可以让异步代码同步化的这么一个库
他让异步变成同步的原理是通过 ES6 的 Generator 这个新特性来解决的
他让写法变成了同步的写法，解决了异步回调的问题
和 promise 应该也有联系
他是KOA框架的核心库

OK，接下来我们就带着这么个问题来他的 github 看一下他的介绍
为了方便观看，我这里把英文的 github 转成了中文


nodejs 和浏览器的基于生成器的控制流优点，使用承诺，让你以一种很好的方式编写非阻塞代码。

因为第四期和第五期的内容都是和 koa 有关的，所以我们先了解下 koa 吧
老样子，我们先百度，发现有四个内容很吸引人啊

第一个和第三个其中有一个肯定是官网
我这里就直接贴上来了，第二个是广告，我们可以不用管它
第四个是我们廖雪峰大大的博客
OK，那 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/10/15/%E3%80%90NodeJS%E3%80%91Node.js%20+%20Vue%20%E5%AE%9E%E7%8E%B0%20Excel%20%E5%AF%BC%E5%87%BA%E4%B8%8E%E4%BF%9D%E5%AD%98/" title="【NodeJS】Node.js + Vue 实现 Excel 导出与保存"><img class="post_bg" src="/my-gitee-blog/img/NodeJs.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【NodeJS】Node.js + Vue 实现 Excel 导出与保存"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/15/%E3%80%90NodeJS%E3%80%91Node.js%20+%20Vue%20%E5%AE%9E%E7%8E%B0%20Excel%20%E5%AF%BC%E5%87%BA%E4%B8%8E%E4%BF%9D%E5%AD%98/" title="【NodeJS】Node.js + Vue 实现 Excel 导出与保存">【NodeJS】Node.js + Vue 实现 Excel 导出与保存</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-14T16:00:00.000Z" title="发表于 2021-10-15 00:00:00">2021-10-15</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Node/">Node</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/Node/">Node</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/Vue/">Vue</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E6%96%87%E4%BB%B6%E5%AF%BC%E5%87%BA/">文件导出</a></span></div><div class="content">Node.js + Vue 实现 Excel 导出与保存我们的项目是前端用vue,服务端用node.js,这个excel导出我们已经用了一年,我们目前用到的无非是图片导出,文本导出,调调excel单元格距离等.
这个node端的封装是经过同事不断的review(感谢同事),俺不断的修改优化后的代码,当时也是我第一次接触node.js,只想告诉你,用它,稳稳的！
node.js服务端代码1.拿到需要导出的数据之后如何使用(假数据模拟,下面是页面)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 constructor(prop) &#123;    super(prop)    // 定义excel头部数据      this.header = [   &#123;     header: &#x27;游戏&#x27;,      key: &#x27;gameInfo&#x27;,     width: 30   & ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/10/14/%E3%80%90HTTP%E3%80%91%E4%B8%BA%E4%BB%80%E4%B9%88%E8%AF%B4HTTPS%E6%AF%94HTTP%E5%AE%89%E5%85%A8%EF%BC%9FHTTPS%E6%98%AF%E5%A6%82%E4%BD%95%E4%BF%9D%E8%AF%81%E5%AE%89%E5%85%A8%E7%9A%84%EF%BC%9F/" title="【HTTP】为什么说HTTPS比HTTP安全? HTTPS是如何保证安全的？"><img class="post_bg" src="/my-gitee-blog/img/Http.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【HTTP】为什么说HTTPS比HTTP安全? HTTPS是如何保证安全的？"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/14/%E3%80%90HTTP%E3%80%91%E4%B8%BA%E4%BB%80%E4%B9%88%E8%AF%B4HTTPS%E6%AF%94HTTP%E5%AE%89%E5%85%A8%EF%BC%9FHTTPS%E6%98%AF%E5%A6%82%E4%BD%95%E4%BF%9D%E8%AF%81%E5%AE%89%E5%85%A8%E7%9A%84%EF%BC%9F/" title="【HTTP】为什么说HTTPS比HTTP安全? HTTPS是如何保证安全的？">【HTTP】为什么说HTTPS比HTTP安全? HTTPS是如何保证安全的？</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-13T16:00:00.000Z" title="发表于 2021-10-14 00:00:00">2021-10-14</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Http/">Http</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/Http/">Http</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/Https/">Https</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E5%8D%8F%E8%AE%AE/">协议</a></span></div><div class="content">为什么说HTTPS比HTTP安全? HTTPS是如何保证安全的？
一、安全特性在什么是HTTP这篇文章中，我们了解到HTTP在通信过程中，存在以下问题：

通信使用明文（不加密），内容可能被窃听

不验证通信方的身份，因此有可能遭遇伪装


而HTTPS的出现正是解决这些问题，HTTPS是建立在SSL之上，其安全性由SSL来保证
在采用SSL后，HTTP就拥有了HTTPS的加密、证书和完整性保护这些功能

❝
SSL(Secure Sockets Layer 安全套接字协议),及其继任者传输层安全（Transport Layer Security，TLS）是为网络通信提供安全及数据完整性的一种安全协议
❞


二、如何做SSL的实现这些功能主要依赖于三种手段：

对称加密：采用协商的密钥对数据加密

非对称加密：实现身份认证和密钥协商

摘要算法：验证信息的完整性

数字签名：身份验证


对称加密对称加密指的是加密和解密使用的秘钥都是同一个，是对称的。只要保证了密钥的安全，那整个通信过程就可以说具有了机密性

非对称加密非对称加密，存在两个秘钥，一个叫公钥，一个叫私钥。两个秘钥是不同 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/10/14/%E3%80%90HTTP%E3%80%91%E9%9D%A2%E8%AF%95%E5%AE%98%EF%BC%9A%E4%BB%80%E4%B9%88%E6%98%AFHTTP%EF%BC%9FHTTP%E5%92%8CHTTPS%E7%9A%84%E5%8C%BA%E5%88%AB%EF%BC%9F/" title="【HTTP】面试官：什么是HTTP？HTTP和HTTPS的区别？"><img class="post_bg" src="/my-gitee-blog/img/Http.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【HTTP】面试官：什么是HTTP？HTTP和HTTPS的区别？"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/14/%E3%80%90HTTP%E3%80%91%E9%9D%A2%E8%AF%95%E5%AE%98%EF%BC%9A%E4%BB%80%E4%B9%88%E6%98%AFHTTP%EF%BC%9FHTTP%E5%92%8CHTTPS%E7%9A%84%E5%8C%BA%E5%88%AB%EF%BC%9F/" title="【HTTP】面试官：什么是HTTP？HTTP和HTTPS的区别？">【HTTP】面试官：什么是HTTP？HTTP和HTTPS的区别？</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-13T16:00:00.000Z" title="发表于 2021-10-14 00:00:00">2021-10-14</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Http/">Http</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/Http/">Http</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/Https/">Https</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E5%8D%8F%E8%AE%AE/">协议</a></span></div><div class="content">面试官：什么是HTTP? HTTP 和 HTTPS 的区别?
一、HTTPHTTP (HyperText Transfer Protocol)，即超文本运输协议，是实现网络通信的一种规范

在计算机和网络世界有，存在不同的协议，如广播协议、寻址协议、路由协议等等……
而HTTP是一个传输协议，即将数据由A传到B或将B传输到A，并且 A 与 B 之间能够存放很多第三方，如：A&lt;=&gt;X&lt;=&gt;Y&lt;=&gt;Z&lt;=&gt;B
传输的数据并不是计算机底层中的二进制包，而是完整的、有意义的数据，如HTML 文件, 图片文件, 查询结果等超文本，能够被上层应用识别
在实际应用中，HTTP常被用于在Web浏览器和网站服务器之间传递信息，以明文方式发送内容，不提供任何方式的数据加密
特点如下：

支持客户/服务器模式

简单快速：客户向服务器请求服务时，只需传送请求方法和路径。由于HTTP协议简单，使得HTTP服务器的程序规模小，因而通信速度很快

灵活：HTTP允许传输任意类型的数据对象。正在传输的类型由Content-Type加以标记

无连接：无连接的含义是限制 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/10/13/%E3%80%90Vue%E3%80%91%E6%95%B4%E7%90%86%E7%9A%84%E4%B8%80%E4%BA%9B%20Vue3%20%E7%9F%A5%E8%AF%86%E7%82%B9/" title="【Vue】整理的一些 Vue3 知识点"><img class="post_bg" src="/my-gitee-blog/img/Vue.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【Vue】整理的一些 Vue3 知识点"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/13/%E3%80%90Vue%E3%80%91%E6%95%B4%E7%90%86%E7%9A%84%E4%B8%80%E4%BA%9B%20Vue3%20%E7%9F%A5%E8%AF%86%E7%82%B9/" title="【Vue】整理的一些 Vue3 知识点">【Vue】整理的一些 Vue3 知识点</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-12T16:00:00.000Z" title="发表于 2021-10-13 00:00:00">2021-10-13</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/">Vue</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/Vue/">Vue</a></span></div><div class="content">整理的一些 Vue3 知识点看完你就基本可以上手搞开发了，本文适合Vue初学者，或者Vue2迁移者，当然还是建议Vue3官网完全过一遍
不适合精通原理，源码的大佬们。
先推荐两个vscode插件Volar首先推荐Volar，使用vscode开发Vue项目的小伙伴肯定都认识Vetur这个神级插件，有了它可以让我们得开发如鱼得水
那么Volar可以理解为Vue3版本的Vetur，代码高亮，语法提示，基本上Vetur有的它都有
特色功能当然作为新的插件出山，肯定有它独有的功能。
多个根节点编辑器不会报错Vue3是允许我们有多个根节点的，但是我们如果使用Vetur就会报错，不会影响运行，但是看起来就很烦
所以当我们转向Volar那么就不会出现这个问题了

编辑器分隔即便Vue的组件化开发，可以将单文件的代码长度大幅缩短，但还是动辄几百行甚是上千行
那么我们切换template，script和style的时候就要频繁上下翻，虽然有的插件可以直接定位到css，但是你回不去啊！所以这个功能简直是太人性化了。
安装完Volar以后，打开一个.vue文件，看vscode的右上角，有这么一个图标，点一下
 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/10/11/%E3%80%90CSS%E3%80%9150%E4%B8%AA%E6%9C%89%E4%BB%B7%E5%80%BC%E7%9A%84CSS%E7%BC%96%E5%86%99%E8%A7%84%E5%88%99%EF%BC%8C%E8%AE%A9%E4%BD%A0%E5%86%99%E5%87%BA%E6%9B%B4%E5%A5%BD%E7%9A%84CSS/" title="【CSS】50个有价值的CSS编写规则，让你写出更好的CSS"><img class="post_bg" src="/my-gitee-blog/img/CSS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【CSS】50个有价值的CSS编写规则，让你写出更好的CSS"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/11/%E3%80%90CSS%E3%80%9150%E4%B8%AA%E6%9C%89%E4%BB%B7%E5%80%BC%E7%9A%84CSS%E7%BC%96%E5%86%99%E8%A7%84%E5%88%99%EF%BC%8C%E8%AE%A9%E4%BD%A0%E5%86%99%E5%87%BA%E6%9B%B4%E5%A5%BD%E7%9A%84CSS/" title="【CSS】50个有价值的CSS编写规则，让你写出更好的CSS">【CSS】50个有价值的CSS编写规则，让你写出更好的CSS</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-10T16:00:00.000Z" title="发表于 2021-10-11 00:00:00">2021-10-11</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/">CSS</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/CSS/">CSS</a></span></div><div class="content">50个有价值的CSS编写规则，让你写出更好的CSS我最近写了篇《掌握和成为更好的Web开发人员的15件事》（地址：https://beforesemicolon.medium.com/15-css-things-to-master-and-become-a-better-web-developer-a18f370a8bc5），然后意识到编写CSS不仅需要专注于某些功能。
通常，使CSS变得困难的原因是，开发人员没有一套可以遵循和使用的工具，以及最佳实践指南，以帮助他们享受编写CSS的乐趣。  
多年来，我收集了一组规则和工具，这些规则和工具在CSS之旅中对我有很大帮助，我想与你分享其中我觉得比较实用及有有价值的50条规则。
1 、使用预处理器CSS 预处理器能够帮助你少写CSS，它们可帮助你组织，避免重复和模块化CSS的工具和实用程序。
我个人更喜欢SASS，但我也同样喜欢LESS和Stylus。
我之所以喜欢他们，是因为他们没有采用“新方式”来设置页面样式。它仍然是CSS，具有额外的语法和功能。
2、分离全局与局部风格区分用于任何一个或一组 HTML 选择器的样式与用于特定事物的样式 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/10/09/%E3%80%90%E5%89%8D%E7%AB%AF%E6%8D%A2%E8%82%A4%E3%80%91%E5%89%8D%E7%AB%AF%E6%8D%A2%E8%82%A4%E7%9A%84N%E7%A7%8D%E6%96%B9%E6%A1%88%EF%BC%8C%E8%AF%B7%E6%94%B6%E4%B8%8B/" title="【前端换肤】前端换肤的N种方案，请收下"><img class="post_bg" src="/my-gitee-blog/img/%E8%9C%82%E7%AA%9D%E5%BD%A2%E5%85%AD%E8%BE%B9%E5%BD%A2%E8%93%9D%E7%B4%AB%E8%89%B2%E8%B0%83%E7%82%AB%E9%85%B7%E8%83%8C%E6%99%AF.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【前端换肤】前端换肤的N种方案，请收下"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/09/%E3%80%90%E5%89%8D%E7%AB%AF%E6%8D%A2%E8%82%A4%E3%80%91%E5%89%8D%E7%AB%AF%E6%8D%A2%E8%82%A4%E7%9A%84N%E7%A7%8D%E6%96%B9%E6%A1%88%EF%BC%8C%E8%AF%B7%E6%94%B6%E4%B8%8B/" title="【前端换肤】前端换肤的N种方案，请收下">【前端换肤】前端换肤的N种方案，请收下</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-08T16:00:00.000Z" title="发表于 2021-10-09 00:00:00">2021-10-09</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/HTML/">HTML</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/HTML/">HTML</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E5%89%8D%E7%AB%AF%E6%8D%A2%E8%82%A4/">前端换肤</a></span></div><div class="content">前端换肤的N种方案，请收下网站换肤的需求，也就是主题切换，该如何切换主题的颜色呢？
以下是网站换肤的实现以及基于换肤拓展的一些方案分享给大家，希望大家在做类似需求的时候能够有些参考。
覆盖样式实现
123456789101112// light$color-brand1: #ffcd32;$fill-1: #fff !default;$color-text: #3c3c3c;$color-text-1: #757575;$color-text-2: #222;// dark$dark-fill-1: #222 !default; // 品牌色$dark-color-text: #fff;$dark-color-text-1: rgba(255, 255, 255, 0.3);$dark-color-text-2: $color-brand1;

123456789101112131415161718192021// 页面使用&lt;style lang=&quot;scss&quot;&gt; @import &quot;./assets/scss/index.scss&quot;;  ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/10/04/%E3%80%90CSS%E3%80%91CSS%20%E4%BB%A3%E7%A0%81%E9%87%8D%E6%9E%84%E4%B8%8E%E4%BC%98%E5%8C%96%E4%B9%8B%E8%B7%AF/" title="【CSS】CSS 代码重构与优化之路"><img class="post_bg" src="/my-gitee-blog/img/CSS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【CSS】CSS 代码重构与优化之路"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/04/%E3%80%90CSS%E3%80%91CSS%20%E4%BB%A3%E7%A0%81%E9%87%8D%E6%9E%84%E4%B8%8E%E4%BC%98%E5%8C%96%E4%B9%8B%E8%B7%AF/" title="【CSS】CSS 代码重构与优化之路">【CSS】CSS 代码重构与优化之路</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-03T16:00:00.000Z" title="发表于 2021-10-04 00:00:00">2021-10-04</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/">CSS</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/CSS/">CSS</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E9%87%8D%E6%9E%84/">重构</a></span></div><div class="content">【CSS】CSS 代码重构与优化之路
*** 学习进阶方式 💪**
基础知识要夯实；
原理源码要深入；
深度广度要扩展；

简短的概括：
1､发现问题：  
项目中css代码痛点：写CSS的同学们往往会体会到，随着项目规模的增加，项目中的CSS代码也会越来越多，如果没有及时对CSS代码进行维护，CSS代码不断会越来越多。你不知道修改这行代码会有什么影响，所以如果有修改或增加新功能时，开发人员往往不敢去删除旧的冗余的代码，而保险地增加新代码，最终的坏处就是项目中的CSS会越来越多，最终陷入无底洞。
2､解决问题：
CSS代码重构：我们写CSS代码时，不仅仅只是完成页面设计的效果，还应该让CSS代码易于管理，维护。我们对CSS代码重构主要有两个目的：提高代码性能，提高代码的可维护性。

一、如何提高 CSS 性能
一､CSS是如何工作的？1､CSS阻止渲染当一个页面有CSS可用时，无论是内联还是外部样式表，浏览器都会延迟渲染，直到CSS被解析。这是因为没有CSS的页面通常是不可用的。
2､CSS可以阻止HTML的解析尽管浏览器在完成CSS解析之前不会显示内容，但它会处理HTML的其余部分 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/10/03/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E9%AA%8C%E8%AF%81%E5%99%A8%E7%AF%87/" title="【一行代码可以实现的事】验证器篇"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【一行代码可以实现的事】验证器篇"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/03/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E9%AA%8C%E8%AF%81%E5%99%A8%E7%AF%87/" title="【一行代码可以实现的事】验证器篇">【一行代码可以实现的事】验证器篇</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-02T16:00:00.000Z" title="发表于 2021-10-03 00:00:00">2021-10-03</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span></div><div class="content">【一行代码可以实现的事】验证器篇检查日期是否为工作日12// `date` is a Date objectconst isWeekday = (date = new Date()) =&gt; date.getDay() % 6 !== 0;

检查日期是否是周末12// `date` is a Date objectconst isWeekend = (date = new Date()) =&gt; date.getDay() % 6 === 0;

检查日期是否在两个日期之间12// `min`, `max` and `date` are `Date` instancesconst isBetween = (date, min, max) =&gt; (date.getTime() &gt;= min.getTime() &amp;&amp; date.getTime() &lt;= max.getTime());

检查日期是否是今天12// `date` is a Date objectconst isToday = (date) =&gt; date.toISOStrin ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/10/01/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%AF%87/" title="【一行代码可以实现的事】字符串篇"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【一行代码可以实现的事】字符串篇"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/01/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%AF%87/" title="【一行代码可以实现的事】字符串篇">【一行代码可以实现的事】字符串篇</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-30T16:00:00.000Z" title="发表于 2021-10-01 00:00:00">2021-10-01</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E5%AD%97%E7%AC%A6%E4%B8%B2/">字符串</a></span></div><div class="content">【一行代码可以实现的事】字符串篇今天是国庆呀，祝我们伟大的祖国母亲生日快乐 (^▽^)
将字符串大写1234567const capitalize = str =&gt; `$&#123;str.charAt(0).toUpperCase()&#125;$&#123;str.slice(1)&#125;`;// Orconst capitalize = ([first, ...rest]) =&gt; `$&#123;first.toUpperCase()&#125;$&#123;rest.join(&#x27;&#x27;)&#125;`;// Examplecapitalize(&#x27;hello world&#x27;);      // &#x27;Hello world&#x27;

检查路径是否是相对的123456const isRelative = path =&gt; !/^([a-z]+:)?[\\/]/i.test(path);// ExamplesisRelative(&#x27;/foo/bar/baz&#x27;);         // falseisR ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/10/01/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E9%9A%8F%E6%9C%BA%E7%AF%87/" title="【一行代码可以实现的事】随机篇"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【一行代码可以实现的事】随机篇"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/10/01/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E9%9A%8F%E6%9C%BA%E7%AF%87/" title="【一行代码可以实现的事】随机篇">【一行代码可以实现的事】随机篇</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-30T16:00:00.000Z" title="发表于 2021-10-01 00:00:00">2021-10-01</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span></div><div class="content">【一行代码可以实现的事】随机篇今天是国庆呀，祝我们伟大的祖国母亲生日快乐 (^▽^)
生成一个随机布尔值1const randomBoolean = () =&gt; Math.random() &gt;= 0.5;

在给定范围内生成一个随机浮点数1const randomFloat = (min, max) =&gt; Math.random() * (max - min) + min;

生成随机十六进制颜色1234const randomColor = () =&gt; `#$&#123;Math.random().toString(16).slice(2, 8).padEnd(6, &#x27;0&#x27;)&#125;`;// Orconst randomColor = () =&gt; `#$&#123;(~~(Math.random()*(1&lt;&lt;24))).toString(16)&#125;`;

在给定范围内生成一个随机整数1const randomInteger = (min, max) =&gt; Math.floor(Math.random()  ...</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/my-gitee-blog/"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/my-gitee-blog/">1</a><span class="page-number current">2</span><a class="page-number" href="/my-gitee-blog/page/3/#content-inner">3</a><a class="page-number" href="/my-gitee-blog/page/4/#content-inner">4</a><a class="extend next" rel="next" href="/my-gitee-blog/page/3/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/my-gitee-blog/img/avatar.png" onerror="this.onerror=null;this.src='/my-gitee-blog/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Vixcity</div><div class="author-info__description">今日事，今日毕</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/my-gitee-blog/archives/"><div class="headline">文章</div><div class="length-num">55</div></a></div><div class="card-info-data-item is-center"><a href="/my-gitee-blog/tags/"><div class="headline">标签</div><div class="length-num">50</div></a></div><div class="card-info-data-item is-center"><a href="/my-gitee-blog/categories/"><div class="headline">分类</div><div class="length-num">18</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/Vixcity"><i class="fab fa-github"></i><span>我的Github</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/Vixcity" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:2091283625@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">这是Vixcity目前的小博客</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/my-gitee-blog/2022/07/13/%E3%80%90NodeJS%E3%80%91NodeJS%20%E6%9C%8D%E5%8A%A1%E7%AB%AF%E8%AF%B7%E6%B1%82/" title="【NodeJS】NodeJS 服务端请求"><img src="/my-gitee-blog/img/NodeJs.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【NodeJS】NodeJS 服务端请求"/></a><div class="content"><a class="title" href="/my-gitee-blog/2022/07/13/%E3%80%90NodeJS%E3%80%91NodeJS%20%E6%9C%8D%E5%8A%A1%E7%AB%AF%E8%AF%B7%E6%B1%82/" title="【NodeJS】NodeJS 服务端请求">【NodeJS】NodeJS 服务端请求</a><time datetime="2022-07-12T16:00:00.000Z" title="发表于 2022-07-13 00:00:00">2022-07-13</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%201/" title="【Hexo】标签样式列表参考 - 1"><img src="/my-gitee-blog/img/hexo.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【Hexo】标签样式列表参考 - 1"/></a><div class="content"><a class="title" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%201/" title="【Hexo】标签样式列表参考 - 1">【Hexo】标签样式列表参考 - 1</a><time datetime="2022-07-11T16:00:00.000Z" title="发表于 2022-07-12 00:00:00">2022-07-12</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%202/" title="【Hexo】标签样式列表参考 - 2"><img src="/my-gitee-blog/img/hexo.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【Hexo】标签样式列表参考 - 2"/></a><div class="content"><a class="title" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%202/" title="【Hexo】标签样式列表参考 - 2">【Hexo】标签样式列表参考 - 2</a><time datetime="2022-07-11T16:00:00.000Z" title="发表于 2022-07-12 00:00:00">2022-07-12</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%203/" title="【Hexo】标签样式列表参考 - 3"><img src="/my-gitee-blog/img/hexo.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【Hexo】标签样式列表参考 - 3"/></a><div class="content"><a class="title" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%203/" title="【Hexo】标签样式列表参考 - 3">【Hexo】标签样式列表参考 - 3</a><time datetime="2022-07-11T16:00:00.000Z" title="发表于 2022-07-12 00:00:00">2022-07-12</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/my-gitee-blog/2022/07/07/%E3%80%90NodeJS%E3%80%91NodeJS%E5%85%A5%E9%97%A8%E5%AD%A6%E4%B9%A0/" title="【NodeJS】NodeJS入门学习"><img src="/my-gitee-blog/img/NodeJs.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【NodeJS】NodeJS入门学习"/></a><div class="content"><a class="title" href="/my-gitee-blog/2022/07/07/%E3%80%90NodeJS%E3%80%91NodeJS%E5%85%A5%E9%97%A8%E5%AD%A6%E4%B9%A0/" title="【NodeJS】NodeJS入门学习">【NodeJS】NodeJS入门学习</a><time datetime="2022-07-06T16:00:00.000Z" title="发表于 2022-07-07 00:00:00">2022-07-07</time></div></div></div></div><div class="card-widget card-mingpian"><div class="card-content"><div class="item-headline"><i class="fa fa-address-card" aria-hidden="true"></i><span>我的名片</span><iframe src="https://muselink.cc/Vixcity" frameborder="0" style="width:99%;height:800px;margin:0;"></iframe></div></div></div><div class="card-widget card-pixiv"><div class="card-content"><div class="item-headline"><i class="fa fa-image-o" aria-hidden="true"></i><span>Pixiv日榜</span><iframe src="https://cloud.mokeyjay.com/pixiv" frameborder="0" style="width:99%;height:380px;margin:0;"></iframe></div></div></div><div class="card-widget card-history"><div class="card-content"><div class="item-headline"><i class="fas fa-clock fa-spin"></i><span>那年今日</span></div><div id="history-baidu" style="height: 100px;overflow: hidden;"><div class="history_swiper-container" id="history-container" style="width: 100%;height: 100%;"><div class="swiper-wrapper" id="history_container_wrapper" style="height:20px"></div></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            <a class="card-more-btn" href="/my-gitee-blog/categories/" title="查看更多">
    <i class="fas fa-angle-right"></i></a>
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/VS-Code/"><span class="card-category-list-name">VS Code</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/git/"><span class="card-category-list-name">git</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%8D%9A%E5%AE%A2/"><span class="card-category-list-name">博客</span><span class="card-category-list-count">3</span></a><ul class="card-category-list child"><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%8D%9A%E5%AE%A2/Hexo/"><span class="card-category-list-name">Hexo</span><span class="card-category-list-count">3</span></a></li></ul></li><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/"><span class="card-category-list-name">大前端</span><span class="card-category-list-count">40</span></a><ul class="card-category-list child"><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/"><span class="card-category-list-name">CSS</span><span class="card-category-list-count">6</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/HTML/"><span class="card-category-list-name">HTML</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Http/"><span class="card-category-list-name">Http</span><span class="card-category-list-count">2</span></a></li></ul></li>
            </ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/my-gitee-blog/tags/CSS/" style="font-size: 1.26em; color: rgb(43, 85, 112)">CSS</a><a href="/my-gitee-blog/tags/%E9%87%8D%E6%9E%84/" style="font-size: 1.15em; color: rgb(146, 148, 48)">重构</a><a href="/my-gitee-blog/tags/%E6%8B%9F%E6%80%81/" style="font-size: 1.15em; color: rgb(127, 142, 119)">拟态</a><a href="/my-gitee-blog/tags/eomji/" style="font-size: 1.15em; color: rgb(17, 36, 81)">eomji</a><a href="/my-gitee-blog/tags/%E5%91%BD%E4%BB%A4%E8%A1%8C/" style="font-size: 1.19em; color: rgb(6, 87, 193)">命令行</a><a href="/my-gitee-blog/tags/HTML/" style="font-size: 1.19em; color: rgb(196, 32, 145)">HTML</a><a href="/my-gitee-blog/tags/Http/" style="font-size: 1.19em; color: rgb(42, 147, 169)">Http</a><a href="/my-gitee-blog/tags/Https/" style="font-size: 1.19em; color: rgb(165, 61, 52)">Https</a><a href="/my-gitee-blog/tags/%E5%8D%8F%E8%AE%AE/" style="font-size: 1.19em; color: rgb(49, 114, 64)">协议</a><a href="/my-gitee-blog/tags/%E8%87%AA%E5%8A%A8%E5%8C%96%E5%8F%91%E5%B8%83/" style="font-size: 1.15em; color: rgb(76, 57, 42)">自动化发布</a><a href="/my-gitee-blog/tags/hexo/" style="font-size: 1.15em; color: rgb(91, 102, 125)">hexo</a><a href="/my-gitee-blog/tags/%E7%BE%8E%E5%8C%96/" style="font-size: 1.22em; color: rgb(128, 142, 62)">美化</a><a href="/my-gitee-blog/tags/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/" style="font-size: 1.22em; color: rgb(124, 188, 55)">技术分享</a><a href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/" style="font-size: 1.41em; color: rgb(90, 140, 53)">代码片段</a><a href="/my-gitee-blog/tags/JS%E5%BA%93/" style="font-size: 1.19em; color: rgb(152, 38, 170)">JS库</a><a href="/my-gitee-blog/tags/JavaScript/" style="font-size: 1.45em; color: rgb(12, 54, 22)">JavaScript</a><a href="/my-gitee-blog/tags/ES6/" style="font-size: 1.15em; color: rgb(92, 17, 188)">ES6</a><a href="/my-gitee-blog/tags/%E6%97%B6%E9%97%B4%E6%97%A5%E6%9C%9F/" style="font-size: 1.15em; color: rgb(172, 36, 139)">时间日期</a><a href="/my-gitee-blog/tags/%E7%BB%A7%E6%89%BF/" style="font-size: 1.15em; color: rgb(28, 160, 107)">继承</a><a href="/my-gitee-blog/tags/Node/" style="font-size: 1.26em; color: rgb(184, 98, 18)">Node</a><a href="/my-gitee-blog/tags/http/" style="font-size: 1.15em; color: rgb(13, 160, 121)">http</a><a href="/my-gitee-blog/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/" style="font-size: 1.15em; color: rgb(102, 23, 158)">服务器</a><a href="/my-gitee-blog/tags/TypeScript/" style="font-size: 1.22em; color: rgb(101, 75, 195)">TypeScript</a><a href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/" style="font-size: 1.38em; color: rgb(84, 177, 196)">一行代码</a><a href="/my-gitee-blog/tags/DOM%E8%8A%82%E7%82%B9/" style="font-size: 1.15em; color: rgb(164, 155, 169)">DOM节点</a><a href="/my-gitee-blog/tags/%E5%87%BD%E6%95%B0/" style="font-size: 1.15em; color: rgb(181, 174, 37)">-函数</a><a href="/my-gitee-blog/tags/%E5%AD%97%E7%AC%A6%E4%B8%B2/" style="font-size: 1.15em; color: rgb(40, 147, 87)">字符串</a><a href="/my-gitee-blog/tags/%E5%AF%B9%E8%B1%A1/" style="font-size: 1.15em; color: rgb(147, 44, 104)">对象</a><a href="/my-gitee-blog/tags/%E6%97%A5%E6%9C%9F%E6%97%B6%E9%97%B4/" style="font-size: 1.15em; color: rgb(61, 109, 105)">日期时间</a><a href="/my-gitee-blog/tags/%E5%89%8D%E7%AB%AF%E6%8D%A2%E8%82%A4/" style="font-size: 1.15em; color: rgb(129, 37, 138)">前端换肤</a><a href="/my-gitee-blog/tags/VS-Code/" style="font-size: 1.15em; color: rgb(182, 44, 109)">VS Code</a><a href="/my-gitee-blog/tags/%E6%8F%92%E4%BB%B6/" style="font-size: 1.15em; color: rgb(185, 167, 74)">插件</a><a href="/my-gitee-blog/tags/%E6%8A%80%E5%B7%A7/" style="font-size: 1.34em; color: rgb(156, 121, 190)">技巧</a><a href="/my-gitee-blog/tags/%E5%B9%B4%E5%BA%A6%E6%80%BB%E7%BB%93/" style="font-size: 1.15em; color: rgb(164, 197, 123)">年度总结</a><a href="/my-gitee-blog/tags/%E5%AE%A1%E7%BE%8E/" style="font-size: 1.3em; color: rgb(119, 147, 61)">审美</a><a href="/my-gitee-blog/tags/%E6%91%84%E5%BD%B1/" style="font-size: 1.3em; color: rgb(34, 96, 141)">摄影</a><a href="/my-gitee-blog/tags/Koa/" style="font-size: 1.19em; color: rgb(172, 178, 26)">Koa</a><a href="/my-gitee-blog/tags/%E6%BA%90%E7%A0%81/" style="font-size: 1.26em; color: rgb(149, 185, 16)">源码</a><a href="/my-gitee-blog/tags/CLI/" style="font-size: 1.15em; color: rgb(90, 47, 155)">CLI</a><a href="/my-gitee-blog/tags/Vue-devtools/" style="font-size: 1.15em; color: rgb(19, 146, 106)">Vue-devtools</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/my-gitee-blog/archives/2022/07/"><span class="card-archive-list-date">七月 2022</span><span class="card-archive-list-count">5</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/my-gitee-blog/archives/2022/04/"><span class="card-archive-list-date">四月 2022</span><span class="card-archive-list-count">8</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/my-gitee-blog/archives/2022/01/"><span class="card-archive-list-date">一月 2022</span><span class="card-archive-list-count">4</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/my-gitee-blog/archives/2021/10/"><span class="card-archive-list-date">十月 2021</span><span class="card-archive-list-count">15</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/my-gitee-blog/archives/2021/09/"><span class="card-archive-list-date">九月 2021</span><span class="card-archive-list-count">23</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">55</div></div><div class="webinfo-item"><div class="item-name">已运行时间 :</div><div class="item-count" id="runtimeshow" data-publishDate="2021-09-06T16:00:00.000Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">95.5k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2022-07-15T01:29:34.711Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('/my-gitee-blog/img/%E5%A4%A7%E5%9C%B0%E7%90%83%E8%83%8C%E6%99%AF.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022 By Vixcity</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div id="running-time"></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="translateLink" type="button" title="简繁转换">简</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/my-gitee-blog/js/utils.js"></script><script src="/my-gitee-blog/js/main.js"></script><script src="/my-gitee-blog/js/tw_cn.js"></script><script src="/my-gitee-blog/js/search/local-search.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>function subtitleType () {
  getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js').then(() => {
    jinrishici.load(function (result) {
      if (true) {
        var sub = "今日事&#44;今日毕,Never put off till tomorrow what you can do today,黑发不知勤学早&#44;白首方悔读书迟,凡是可以用 JavaScript 来写的应用&#44;最终都会用 JavaScript 来写。——Atwood定律".length == 0 ? new Array() : "今日事&#44;今日毕,Never put off till tomorrow what you can do today,黑发不知勤学早&#44;白首方悔读书迟,凡是可以用 JavaScript 来写的应用&#44;最终都会用 JavaScript 来写。——Atwood定律".split(',')
        var content = result.data.content
        var both = sub.unshift(content)
        var typed = new Typed('#subtitle', {
          strings: sub,
          startDelay: 300,
          typeSpeed: 150,
          loop: true,
          backSpeed: 50,
        })
      } else {
        document.getElementById('subtitle').innerHTML = result.data.content
      }
    })
  })
}

if (true) {
  if (typeof Typed === 'function') {
    subtitleType()
  } else {
    getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
  }
} else {
  subtitleType()
}
</script></div><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/my-gitee-blog/js/newStyle.js"></script><script src="/my-gitee-blog/js/sakura.js"></script><script>setInterval(()=>{let create_time=Math.round(new Date("2021-9-8-00:00:00").getTime()/1000);let timestamp=Math.round((new Date().getTime()+8*60*60*1000)/1000);let second=timestamp-create_time;let time=new Array(0,0,0,0,0);if(second>=365*24*3600){time[0]=parseInt(second/(365*24*3600));second%=365*24*3600}if(second>=24*3600){time[1]=parseInt(second/(24*3600));second%=24*3600}if(second>=3600){time[2]=parseInt(second/3600);second%=3600}if(second>=60){time[3]=parseInt(second/60);second%=60}if(second>0){time[4]=second}currentTimeHtml='小博客已经安全运行 '+time[0]+' 年 '+time[1]+' 天 '+time[2]+' 时 '+time[3]+' 分 '+time[4]+' 秒';var elementById=document.getElementById('running-time');if(elementById){elementById.innerHTML=currentTimeHtml}},1000);</script><script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script><script src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/js/main.js"></script><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><!-- hexo injector body_end start --><script data-pjax>function electric_clock_injector_config(){
                var parent_div_git = document.getElementsByClassName('sticky_layout')[0];
                var item_html = '<div class="card-widget card-clock"><div class="card-glass"><div class="card-background"><div class="card-content"><div id="hexo_electric_clock"><img id="card-clock-loading" src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-clock/clock/images/weather/loading.gif" style="height: 120px; width: 100%;" data-ll-status="loading" class="entered loading"></div></div></div></div></div>';
                console.log('已挂载electric_clock')
                // parent_div_git.innerHTML=item_html+parent_div_git.innerHTML // 无报错，但不影响使用(支持pjax跳转)
                parent_div_git.insertAdjacentHTML("afterbegin",item_html) // 有报错，但不影响使用(支持pjax跳转)
            }if( document.getElementsByClassName('sticky_layout')[0] && (location.pathname ==='all'|| 'all' ==='all')){

            electric_clock_injector_config()
        } </script><script src="https://pv.sohu.com/cityjson?ie=utf-8"></script><script data-pjax  src="https://cdn.jsdelivr.net/gh/Zfour/hexo-electric-clock@1.0.6/clock.js"></script><div class="js-pjax"><script async="async">var arr = document.getElementsByClassName('recent-post-item');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '1s');
    arr[i].setAttribute('data-wow-delay', '0.5s');
    arr[i].setAttribute('data-wow-offset', '100');
    arr[i].setAttribute('data-wow-iteration', '1');
  }</script><script async="async">var arr = document.getElementsByClassName('card-widget');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script></div><script defer src="https://unpkg.zhimg.com/hexo-butterfly-wowjs/lib/wow.min.js"></script><script defer src="https://unpkg.zhimg.com/hexo-butterfly-wowjs/lib/wow_init.js"></script><!-- hexo injector body_end end --><script src="/my-gitee-blog/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body></html>